package my.mark.mybaibaoxiang.jvm;

/**
 * @author twotiger-wxm.
 * @date 2020-4-24.
 */
public class User {

    private int index;
    private String name;

    public User() {
    }

    public User(int index, String name) {
        this.index = index;
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    protected void finalize() throws Throwable {
        //finalize方法是对象脱逃死亡命运的最后一次机会。
        //OOMTest.list1.add(this);
        System.out.println("关闭资源"+this.getIndex()+"即将被回收........");
        super.finalize();
    }
}
